package com.cysd.ewmxns.viewmodel

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.cszy.ewmxns.base.BaseViewModel
import com.hlyj.http.base.tool.lib_hlyj_base.bean.BaseResult
import com.hlyj.http.base.tool.lib_hlyj_base.bean.music.MusicListBean
import com.hlyj.http.base.tool.lib_hlyj_base.net.ApiCallback
import com.hlyj.http.base.tool.lib_hlyj_base.qrcode.BaseResult_Qrcode
import com.hlyj.http.base.tool.lib_hlyj_base.qrcode.QrResultBean
import com.ok.common.api.GlobalApi
import org.litepal.LitePal

class TXMScanViewModel :BaseViewModel(){
    private val _queryResult = MutableLiveData<QrResultBean?>()
    val queryQrResult: LiveData<QrResultBean?> = _queryResult
    private val _errorMessage = MutableLiveData<String>()
    val errorMessage: LiveData<String> = _errorMessage
    fun queryShop(barcode:String) {
             GlobalApi.getShopList(barcode,object :
                ApiCallback<BaseResult_Qrcode<QrResultBean?>> {


                override fun onSuccess(result: BaseResult_Qrcode<QrResultBean?>) {

                    _queryResult.postValue(result?.data)
                }

                override fun onFailure(errorMessage: String) {
                    _errorMessage.postValue(errorMessage)
                }

                override fun onFinish() {

                }

            })


    }
}